﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.DAL.DocumentCenter;
using Microsoft.SharePoint;
using MS.InformationManagement.Support.Constants;

namespace MS.InformationManagement.DAL.DTOs
{
    public class PersonContactDTO : BaseContactDTO<Personas>
    {

        #region Constructors

        public PersonContactDTO(SPListItemCollection items) : base(items) { }

        #endregion

        #region Implemented Methods

        public override IEnumerable<Personas> GetEntities()
        {
            IEnumerable<Personas> entidades = from item in this._foundedItems.OfType<SPListItem>()
                                              select new Personas
                                               {
                                                   ID = item[CustomSiteColumns.FLD_CONTACT_ID] +"",
                                                   Nombres = item[CustomSiteColumns.FLD_CONTACT_NAMES] + "",
                                                   PrimerApellido = item[CustomSiteColumns.FLD_CONTACT_FIRST_NAME]+"",
                                                   SegundoApellido = item[CustomSiteColumns.FLD_CONTACT_LAST_NAME] + "",
                                                   Teléfono = item[CustomSiteColumns.FLD_CONTACT_PHONE] + "",
                                                   Email = item[CustomSiteColumns.FLD_CONTACT_EMAIL] + "",
                                                   Dirección = item[CustomSiteColumns.FLD_CONTACT_ADDRESS] + ""
                                               };
            return entidades;
        }

        #endregion
    }
}
